// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

const int N = 105, M = N * N;

typedef long long LL;
int n, m;
bool flg;

int id[N][N];
int x[M], y[M];


int main(int argc, char const *argv[]) {
    // code
    scanf("%d", &n);
    m = n + 1;
    int tot = 0;
    for (int i=1; i<=n; ++i) {
        for (int j=1; j<=m; ++j) {
            id[i][j] = ++tot;
            x[tot] = i;
            y[tot] = j;
        }
    }
    vector<int> ans;
    if (m % 2 == 0) {
        
        // ans.push_back(1);
        for (int i=1; i<=m; i+=2) {
            ans.push_back(id[1][i]);
            ans.push_back(id[1][i+1]);
            for (int j=2; j<=n; j+=2) {
                ans.push_back(id[j][i]);
                ans.push_back(id[j+1][i+1]);
            }
            // ans.push_back(id[n][i]);
            for (int j=n; j>=3; j-=2) {
                ans.push_back(id[j][i]);
                ans.push_back(id[j-1][i+1]);
            }
        }
    } else {
        for (int i=1; i+1<=m; i+=2) {
            ans.push_back(id[1][i]);
            for (int j=2; j+1<=n; j+=2) {
                ans.push_back(id[j][i+1]);
                ans.push_back(id[j+1][i]);
            }
            ans.push_back(id[n][i+1]);
            for (int j=n; j>=2; j-=2) {
                ans.push_back(id[j][i]);
                ans.push_back(id[j-1][i+1]);
            }
        }
        for (int i=1; i<=n; ++i)
            ans.push_back(id[i][m]);
    }
    printf("%d\n", sz(ans)-1);
    for (int id : ans) {
        int xx = x[id], yy = y[id];
        if (flg)
            swap(xx, yy);
        printf("%d %d\n", xx, yy);
    }    
    return 0;
}
